package com.gmrz.uas.plugin.authservice;

import com.gmrz.uas.plugin.authservice.exception.InvalidConfigException;
import com.gmrz.uas.plugin.exception.PluginException;
import com.gmrz.uas.plugin.provider.ServiceProvider;

import java.util.List;
import java.util.Map;

/**
 * Created by gongyuqiang on 2017/5/13.
 */
public interface AuthServicePlugin {


    /**
     * 获取插件Id
     * @return
     */
    String getPluginId();

    /**
     * 设置uas provider
     * @param provider
     */
    void setServiceProvider(ServiceProvider provider);
    /**
     * 获取所有配置描述
     * @return
     */
    Map<String, AuthServiceConfigSpec> getAllConfigSpec();

    /**
     * 获取AuthServiceData描述
     * @return
     */
    Map<String, AuthServiceDataSpec> getAllDataSpec();
    /**
     * 获取插件配置
     * @return
     */
    Map<String, String> getAllConfig();

    /**
     * 设置系统配置
     * @param allConfig
     */
    void setAllConfig(Map<String, String> allConfig) throws InvalidConfigException;
    /**
     *
     * @return
     */
    List<AuthServiceData> pregregister(String userId) throws PluginException;
    /**
     * 认证服务注册
     * @param userId
     * @param contents
     */
    void register(String userId, List<AuthServiceData> contents) throws PluginException;

    /**
     * 认证服务注销
     * @param userId
     */
    void unregister(String userId) throws PluginException;

    /**
     *
     * @param userId
     * @return
     */
    List<AuthServiceData> preauthenticate(String userId) throws PluginException;
    /**
     * 认证服务认证
     * @param userId
     * @param contents
     */
    void authenticate(String userId, List<AuthServiceData> contents) throws PluginException;
}
